package edu.gatech.cs2340.thecyclonesquad.models;

public class Person {
	
	static public final Person NULL_PERSON = new Person("nobody", "no");
	public String username;
	public String password;
	public int loginAttempts = 0;
	public boolean locked = false;
	public boolean admin = false;
	
	/**
	 * Constructor for person class.
	 * @param username is the username of an account
	 * @param password is the password associated with the username of the account
	 */
	public Person(String username, String password) {
		this.username=username;
        this.password=password;
	}
	
	/**
	 * Verify if password is correct or not.
	 * @param password is the password string typed in the login screen
	 * @return 1 if password is correct, return 2 if user is locked, return 3 if just an incorrect password
	 */
	public int verify(String password) {
		if (password.equals(this.password) & locked==false) {
			loginAttempts = 0;
			return 1;
		} else if (loginAttempts >= 3) {
			//locked = true;
            return 2;
        } else{
        	if (loginAttempts == 2) {
        		locked = true;
        	}
            return 3;
        }
	}
}
